// Ternar Searching // Finding the closest point from one point to a line#include<stdio.h>#include<math.h>#define sqr(x) (x)*(x)double m1x, m1y, m2x, m2y, d1, d2;int main () {        double lx, ly, thirdx, thirdy, rx, ry;        scanf("%lf %lf", &rx, &ry);    scanf("%lf %lf", &lx, &ly);    scanf("%lf %lf", &thirdx, &thirdy);        while ( fabs(rx - lx) >= 0.00001) {        m1x = lx + (rx-lx)/3 ;        m2x = rx - (rx-lx)/3 ;                m1y = ly + (ry-ly)/3 ;        m2y = ry - (ry-ly)/3 ;                d1 = sqrt(sqr(thirdx-m1x) + sqr(thirdy-m1y));        d2 = sqrt(sqr(thirdx-m2x) + sqr(thirdy-m2y));                if(d1 <= d2){            rx = m2x;            ry = m2y;        }        else{            lx = m1x;            ly = m1y;        }    }        printf("(%.2lf,%.2lf)", rx , ry);    }